<template>
    <view class="container data-v-d36b58a0">
        <view class="header-tabs data-v-d36b58a0">
            <view @tap="__e" :class="['tab-item', 'data-v-d36b58a0', current == 0 ? 'active' : '']" :data-current="0" :data-event-opts="[['tap', [['e0', ['$event']]]]]">
                <text class="text data-v-d36b58a0">邀请记录</text>
            </view>
            <view @tap="__e" :class="['tab-item', 'data-v-d36b58a0', current == 1 ? 'active' : '']" :data-current="1" :data-event-opts="[['tap', [['e1', ['$event']]]]]">
                <text class="text data-v-d36b58a0">分销订单</text>
            </view>
        </view>
        <view class="swiper-wrapper data-v-d36b58a0">
            <swiper @change="__e" class="data-v-d36b58a0" :current="current" :data-event-opts="[['change', [['swiperChange', ['$event']]]]]">
                <swiper-item class="data-v-d36b58a0">
                    <scroll-view @scrolltolower="__e" class="data-v-d36b58a0" :data-event-opts="[['scrolltolower', [['scrolltolower', ['$event']]]]]" :scrollY="true">
                        <user-item @__l="__l" class="data-v-d36b58a0" :info="item" :vueId="'086d3467-1-' + index" v-for="(item, index) in userList" :key="index"></user-item>
                        <no-data @__l="__l" class="data-v-d36b58a0" title="暂无邀请记录" vueId="086d3467-2" v-if="!$root.g0"></no-data>
                    </scroll-view>
                </swiper-item>
                <swiper-item class="data-v-d36b58a0">
                    <scroll-view @scrolltolower="__e" class="data-v-d36b58a0" :data-event-opts="[['scrolltolower', [['scrolltolower', ['$event']]]]]" :scrollY="true">
                        <agent-record-item
                            @__l="__l"
                            class="data-v-d36b58a0"
                            :info="item"
                            :vueId="'086d3467-3-' + index"
                            v-for="(item, index) in orderList"
                            :key="index"
                        ></agent-record-item>
                        <no-data @__l="__l" class="data-v-d36b58a0" title="暂无分销订单" vueId="086d3467-4" v-if="!$root.g1"></no-data>
                    </scroll-view>
                </swiper-item>
            </swiper>
        </view>
        <view class="footer-c data-v-d36b58a0">
            <view class="btn-c data-v-d36b58a0">
                <navigator class="btn data-v-d36b58a0" url="/pages/rule/index?type=share">
                    <view class="btn check-rule data-v-d36b58a0"></view>
                </navigator>
                <navigator class="btn data-v-d36b58a0" url="/pages/myRedpack/index">
                    <view class="btn data-v-d36b58a0"></view>
                </navigator>
            </view>
        </view>
    </view>
</template>

<script>
import noData from '@/components/NoData/NoData';
import userItem from '@/pages/myInvitees/components/UserItem';
import agentRecordItem from '@/pages/myInvitees/components/AgentRecordItem';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/myInvitees/index'],
    {
        '0792': function (t, e, n) {
            'use strict';

            n.r(e);
            var a = n('4f1c');
            var i = n.n(a);
            for (var r in a) {
                if (['default'].indexOf(r) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return a[t];
                        });
                    })(r);
                }
            }
            e.default = i.a;
        },
        '16a0': function (t, e, n) {},
        '18f6': function (t, e, n) {},
        4832: function (t, e, n) {
            'use strict';

            n.r(e);
            var a = n('dad9');
            var i = n('0792');
            for (var r in i) {
                if (['default'].indexOf(r) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return i[t];
                        });
                    })(r);
                }
            }
            n('a349');
            n('8d92');
            var o = n('f0c5');
            var u = Object(o.a)(i.default, a.b, a.c, false, null, 'd36b58a0', null, false, a.a, void 0);
            e.default = u.exports;
        },
        '4f1c': function (t, e, n) {
            'use strict';

            (function (t) {
                var a = n('4ea4');
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var i = a(n('2eee'));
                var r = a(n('c973'));
                var o = {
                    components: {
                        UserItem: function () {
                            n.e('pages/myInvitees/components/UserItem')
                                .then(
                                    function () {
                                        return resolve(n('6bc0'));
                                    }.bind(null, n)
                                )
                                .catch(n.oe);
                        },
                        AgentRecordItem: function () {
                            n.e('pages/myInvitees/components/AgentRecordItem')
                                .then(
                                    function () {
                                        return resolve(n('ed8d'));
                                    }.bind(null, n)
                                )
                                .catch(n.oe);
                        }
                    },
                    data: function () {
                        return {
                            current: 0,
                            userList: [],
                            orderList: [],
                            page: 1,
                            per_page: 20
                        };
                    },
                    computed: {},
                    onLoad: function (e) {
                        var that = this;
                        return (0, r.default)(
                            i.default.mark(function a() {
                                return i.default.wrap(function (a) {
                                    for (;;) {
                                        switch ((a.prev = a.next)) {
                                            case 0:
                                                that.current = e.actived || 0;
                                                t.showLoading({
                                                    title: '加载中'
                                                });
                                                that.initData();
                                                t.hideLoading();
                                            case 4:
                                            case 'end':
                                                return a.stop();
                                        }
                                    }
                                }, a);
                            })
                        )();
                    },
                    onShow: function () {},
                    methods: {
                        initData: function () {
                            var that = this;
                            this.$http('/user/invitees', 'get', {
                                per_page: this.per_page,
                                page: this.page,
                                type: 'direct'
                            }).then(function (e) {
                                that.userList = e.data.list;
                            });
                            this.$http({
                                url: '/agent/brokerages',
                                method: 'get',
                                params: {
                                    per_page: this.per_page,
                                    page: this.page
                                }
                            }).then(function (e) {
                                that.orderList = e.data.list;
                            });
                        },
                        fetchNextPage: function () {
                            var that = this;
                            if (this.loading) {
                                return false;
                            }
                            this.loading = true;
                            this.page++;
                            this.$http('/user/invitees', 'get', {
                                per_page: this.per_page,
                                page: this.page,
                                type: 'direct'
                            }).then(function (e) {
                                that.userList = that.userList.concat(e.data.list);
                                that.loading = false;
                            });
                        },
                        swiperChange: function (t) {
                            var e = t.detail.current;
                            this.current = e;
                        },
                        scrolltolower: function () {
                            this.fetchNextPage();
                        }
                    }
                };
                e.default = o;
            }.call(this, n('543d').default));
        },
        '7ef9': function (t, e, n) {
            'use strict';

            (function (t, e) {
                var a = n('4ea4');
                n('18ba');
                a(n('66fd'));
                var i = a(n('4832'));
                t.__webpack_require_UNI_MP_PLUGIN__ = n;
                e(i.default);
            }.call(this, n('bc2e').default, n('543d').createPage));
        },
        '8d92': function (t, e, n) {
            'use strict';

            var a = n('18f6');
            n.n(a).a;
        },
        a349: function (t, e, n) {
            'use strict';

            var a = n('16a0');
            n.n(a).a;
        },
        dad9: function (t, e, n) {
            'use strict';

            n.d(e, 'b', function () {
                return i;
            });
            n.d(e, 'c', function () {
                return r;
            });
            n.d(e, 'a', function () {
                return a;
            });
            var a = {
                NoData: function () {
                    return n.e('components/NoData/NoData').then(n.bind(null, 'cafe'));
                }
            };
            var i = function () {
                var that = this;
                var e = (that.$createElement, that._self._c, that.userList.length);
                var n = that.orderList.length;
                that._isMounted ||
                    ((that.e0 = function (e) {
                        that.current = 0;
                    }),
                    (that.e1 = function (e) {
                        that.current = 1;
                    }));
                that.$mp.data = Object.assign(
                    {},
                    {
                        $root: {
                            g0: e,
                            g1: n
                        }
                    }
                );
            };
            var r = [];
        }
    },
    [['7ef9', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './index.css';
</style>
